package wang.API;

import java.util.Random;

public class StringYZMDemo {
    public static void main(String[] args) {


        //通过string方法实现随机验证码
        int code = 0;
        String data = "abcdefghijklmnopqistuvwxyzABCDEFGHIJKLMNOPQISYUVWXYZ0123456789";
        System.out.println(YZM(4, data));


    }
    public static String YZM( int a, String q){
        String yzm = "";
        Random data = new Random();
        for (int i = 0; i < a; i++) {
            int b = data.nextInt(q.length());
            yzm += q.charAt(b);
        }
        return yzm;
    }

    }